package com.wpml;

import com.wpml.annotation.Controller;
import com.wpml.annotation.Param;
import com.wpml.annotation.RequestMapping;
import com.wpml.po.User;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Description
 * @Date 2021-08-19
 * @Author wangpei
 **/
@Controller
public class UserController {

    @RequestMapping("/login")
    public void login(HttpServletRequest req, HttpServletResponse resp, User user) throws IOException {
        resp.setContentType("text/html;charset=utf-8");
        System.out.println("进入login方法: " + user);
        resp.getWriter().println("login success");
    }

    @RequestMapping("/testParam")
    public void testParam(String name, Integer age, String addr){

        System.out.println(String.format("name = %s, age = %s, addr = %s", name, age, addr));
    }

    public void testMethod(String name){

        System.out.println(String.format("name = %s", name));
    }
}
